<%--
  Created by IntelliJ IDEA.
  User: 11507
  Date: 2019/6/20
  Time: 12:19
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>

<nav class="navbar navbar-expand-sm row bg-light navbar-light" style="margin-bottom: 1rem">
    <!-- Brand -->
    <a class="navbar-brand" href="index.jsp">Spring学生信息管理系统</a>
    ​
    <!-- Links -->

    <%
        String headAcountHtml = "<ul class=\"navbar-nav\">\n" +
                "        <li class=\"nav-item\">\n" +
                "            <a class=\"nav-link\" href=\"login.jsp\">登陆</a>\n" +
                "        </li>\n" +
                "        <li class=\"nav-item\">\n" +
                "            <a class=\"nav-link\" href=\"register.jsp\">注册</a>\n" +
                "        </li>\n" +
                "    </ul>";
        ServletContext headContext = (ServletContext) request.getServletContext();
        String headAcount = (String) headContext.getAttribute("acountNumber");
        if (headAcount != null) {
            out.print("<span class=\"navbar-text\">" + headAcount + "</span>");
            out.print("<a class=\"offset-7\" href=\"exit_user.jsp?acount=" + headAcount + "\">退出登陆</a>");
        } else {
            out.print(headAcountHtml);
        }
    %>
</nav>